
package com.joysuch.wwyt.edu.enums;

public enum ExamJoinInTargetTypes {

    // COURSE("cou", "课程", EduCourse.class, "typeId"),
    USER("U", "单选题"), JOB("J", "岗位"), DEPART("D", "部门");

    private String code;
    private String name;

    private ExamJoinInTargetTypes(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ExamJoinInTargetTypes findByName(String name) {
        ExamJoinInTargetTypes[] values = ExamJoinInTargetTypes.values();
        for (ExamJoinInTargetTypes v : values) {
            if (v.getName().equals(name)) {
                return v;
            }
        }
        return null;
    }

    public static ExamJoinInTargetTypes findByCode(String code) {
        ExamJoinInTargetTypes[] values = ExamJoinInTargetTypes.values();
        for (ExamJoinInTargetTypes v : values) {
            if (v.getCode().equals(code)) {
                return v;
            }
        }
        return null;
    }

    public static String findNameByCode(String code) {
        ExamJoinInTargetTypes types = findByCode(code);
        return types == null ? null : types.name;
    }
}
